﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SiteAdmin.Master" Inherits="System.Web.Mvc.ViewPage<Beeldbankmvc.ViewModels.ReactionViewModel>" %>

<%@ Import Namespace="Beeldbankmvc.Models" %>
<%@ Import Namespace="Beeldbankmvc.Code" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">Meldingen overzicht</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% Html.RenderAction("AdminMenu", "Miscellaneous"); %>
    <h2>Meldingen overzicht</h2>

    <table class="winkelwagen" summary="Correspondentie">
        <caption>
            Meldingen</caption>
        <thead>
            <tr>
                <td></td>
                <td colspan="2">
                    <h4><%:Html.ActionLink("Open meldingen", "Index", "Reaction", new { reactionPageIndex = 0, sort = Request.QueryString["sort"] }, null)%></h4>
                </td>
                <td colspan="2">
                    <h4>Alle meldingen</h4>
                </td>
            </tr>
            <tr>
                <%if ((Request.QueryString["sort"] == null) || (Request.QueryString["sort"] != null && Request.QueryString["sort"].Equals("mediaObject")))
                  {%>
                <th scope="colgroup" style="width:10px;">
                </th>
                <th scope="colgroup" style="width:120px;">
                    Datum
                </th>
                <th scope="colgroup" style="width:80px;">
                    Categorie
                </th>
                <th scope="colgroup" style="width:160px;">
                    Onderwerp
                </th>
                <th scope="colgroup" style="width:60px;">
                    Status
                </th>
                <% }
                  else
                  {%>
                <th scope="colgroup" style="width:10px;">
                </th>
                <th scope="colgroup" style="width:120px;">
                    <a href="?sort=datum">Datum</a>
                </th>
                <th scope="colgroup" style="width:80px;">
                    <a href="?sort=categorie">Categorie</a>
                </th>
                <th scope="colgroup" style="width:160px;">
                    <a href="?sort=onderwerp">Onderwerp</a>
                </th>
                <th scope="colgroup" style="width:60px;">
                    <a href="?sort=status">Status</a>
                </th>
                <% } %>
            </tr>
            <tr>
                <th></th>
                <th colspan="4" scope="colgroup">
                    Boodschap
                </th>
            </tr>
            <tr>
                <th colspan="5" scope="col">
                    
                </th>
            </tr>
        </thead>
        <tbody>
            <% foreach (BEELDBANK_REACTIE reaction in Model.reactionObjects)
               { %>
            <tr>
                <td>
                    <a href="<%= Url.Action("Delete", "Reaction", new { id=reaction.Id }) %>">
                        <img alt="Verwijder reactie" title="Verwijder reactie" src="<%=AppHelper.getContent("~/Content/images/delete.gif") %>"
                            onclick="javascript:return confirm('Deze reactie zal permanent worden verwijderd, weet u het zeker?');" /></a>
                </td>
                <td style="white-space:nowrap">
                    <% if (reaction.MediaObjectId != null && reaction.MediaObjectId != 0)
                       {%>
                    <%= Html.ActionLink(reaction.Datum.ToString(), "Edit", "MediaObject", new { id = reaction.MediaObjectId, reactionId = reaction.Id }, null)%>&nbsp;
                    <% }
                       else
                       { %>
                    <%= Html.ActionLink(reaction.Datum.ToString(), "Edit", "Reaction", new { id = reaction.Id }, null)%>&nbsp;
                    <% }%>
                </td>
                <td>
                    <%: IdMapper.mapReactionCategory(reaction.Category) %>&nbsp;
                </td>
                <td>
                    <%: IdMapper.mapReactionSubject(reaction.Subject) %>&nbsp;
                    <% if (reaction.MediaObjectId != null && reaction.MediaObjectId != 0)
                       {%>voor&nbsp;<%: reaction.MediaObjectEigenaarNaam %><% }%>
                </td>
                <td>
                    <% if (reaction.BEELDBANK_REACTIESTATUS != null)
                       {%>
                    <%: reaction.BEELDBANK_REACTIESTATUS.Name %>&nbsp;
                    <% } %>
                </td>
            </tr>
            <tr>
                <td></td>
                <td colspan="4">
                    <%: reaction.Boodschap %>&nbsp;
                </td>
            </tr>
            <%} %>
        </tbody>
    </table>
    <div style="width: 100%; text-align: center;">
        <%
            int thirdPageIndex = 0;
            while (Model.numberOfRowsReaction > (thirdPageIndex * Model.pageSize))
            {
        %>
        <%:Html.ActionLink((thirdPageIndex + 1).ToString(), "IndexClosed", "Reaction", new { reactionPageIndex = thirdPageIndex, sort=Request.QueryString["sort"] }, null)%>&nbsp;
        <%
thirdPageIndex++;
            }
        %>
    </div>
</asp:Content>
